import telnetlib

def cisco(namet,ipt,usernamet,passwordt):
    tn = telnetlib.Telnet(ipt)
    tn.read_until(b'Username:')
    tn.write(usernamet.encode('ascii') + b"\n")
    tn.read_until(b'Password:')
    tn.write(passwordt.encode('ascii') + b"\n")
    tn.read_until(b'#').decode('ascii')
    tn.write('terminal length 0'.encode('ascii') + b"\n")
    tn.read_until(b'#').decode('ascii')
    tn.write('show run'.encode('ascii') + b"\n")
    aa = namet + '\n' + tn.read_until(b'#').decode('ascii')
    tn.close()
    return aa

def huawei(namet,ipt,passwordt):
    tn = telnetlib.Telnet(ipt)
    tn.read_until(b'Password:')
    tn.write(passwordt.encode('ascii') + b"\n")
    tn.read_until(b'>').decode('ascii')
    tn.write('screen-length 0 temporary'.encode('ascii') + b"\n")
    tn.read_until(b'>').decode('ascii')
    tn.write('dis cur'.encode('ascii') + b"\n")
    aa = namet + '\n' + tn.read_until(b'>').decode('ascii')
    tn.close()
    return aa

